Avoid a crash when setting a tooltip on a GtkCalendar
authorMatthias Clasen <mclasen@redhat.com>
Tue, 9 Feb 2010 02:18:13 +0000 (21:18 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 9 Feb 2010 18:41:58 +0000 (13:41 -0500)
The details code was assuming that it controls ::has-tooltip.
Reported by Bill Nottingham, bug 607344.

gtk/gtkcalendar.c

index 8bc6e63cfe8d023fccf2e11b4390e6958909a9fe..13488e50a2a2968292bb8228127def1b7943f663 100644 (file)
@@ -1679,6 +1679,9 @@ gtk_calendar_get_detail (GtkCalendar *calendar,
   GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
   gint year, month;
 
+  if (priv->detail_func == NULL)
+    return NULL;
+
   year = calendar->year;
   month = calendar->month + calendar->day_month[row][column] - MONTH_CURRENT;
 
@@ -2494,10 +2497,7 @@ calendar_paint_day (GtkCalendar *calendar,
 
   /* Get extra information to show, if any: */
 
-  if (priv->detail_func)
-    detail = gtk_calendar_get_detail (calendar, row, col);
-  else
-    detail = NULL;
+  detail = gtk_calendar_get_detail (calendar, row, col);
 
   layout = gtk_widget_create_pango_layout (widget, buffer);
   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);